<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>File::Glob - Perl extension for BSD glob routine - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/File::Glob">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./File::Glob.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/File::Glob">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/File::Glob">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/File::Glob">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/File::Glob">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/File::Glob">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/File::Glob">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/File::Glob">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/File::Glob">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/File::Glob">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/File::Glob">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/File::Glob">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/File::Glob">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/File::Glob">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/File::Glob">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/File::Glob">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/File::Glob">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/File::Glob">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/File::Glob">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/File::Glob">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/File::Glob">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/File::Glob">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/File::Glob">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/File::Glob">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/File::Glob">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/File::Glob">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/File::Glob">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/File::Glob">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/File::Glob">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/File::Glob">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/File::Glob">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/File::Glob">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/File::Glob">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/File::Glob">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/File::Glob">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/File::Glob">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/File::Glob">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/File::Glob">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/File::Glob">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/File::Glob">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/File::Glob">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/File::Glob">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/File::Glob">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/File::Glob">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/File::Glob">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/File::Glob">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/File::Glob">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/File::Glob">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/File::Glob">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/File::Glob">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/File::Glob">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/File::Glob">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/File::Glob">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/File::Glob">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/File::Glob">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/File::Glob">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/File::Glob">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/File::Glob">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/File::Glob">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/File::Glob">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/File::Glob">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/File::Glob">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/File::Glob">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/File::Glob">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/File::Glob">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/File::Glob">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/File::Glob">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/File::Glob">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/File::Glob">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/File::Glob">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/File::Glob">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/File::Glob">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/File::Glob">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/File::Glob">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/File::Glob">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/File::Glob">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/File::Glob">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/File::Glob">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/File::Glob">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/File::Glob">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/File::Glob">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./File::Glob.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/File::Glob">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/File::Glob">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/File::Glob">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/File::Glob">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/File::Glob">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/File::Glob">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/File::Glob">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/File::Glob">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/File::Glob">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/File::Glob">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/File::Glob">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/File::Glob">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/File::Glob">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/File::Glob">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/File::Glob">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/File::Glob">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/File::Glob">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/File::Glob">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/File::Glob">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/File::Glob">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/File::Glob">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/File::Glob">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/File::Glob">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/File::Glob">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/File::Glob">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/File::Glob">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/File::Glob">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/File::Glob">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/File::Glob">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/File::Glob">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/File::Glob">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/File::Glob">5.35.1</a>
          <a class="dropdown-item active" href="./File::Glob.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./File::Glob.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./File::Glob.html">File::Glob</a>
          <div id="more">
            (<a href="./File::Glob.txt">source</a>,
            <a href="https://metacpan.org/pod/File::Glob">CPAN</a>)
          </div>
            <div id="moduleversion">version 1.33</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#DESCRIPTION">DESCRIPTION</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#META-CHARACTERS">META CHARACTERS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#EXPORTS">EXPORTS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#:bsd_glob">:bsd_glob</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#:glob">:glob</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#bsd_glob">bsd_glob</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#:nocase-and-:case">:nocase and :case</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#csh_glob">csh_glob</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#POSIX-FLAGS">POSIX FLAGS</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#DIAGNOSTICS">DIAGNOSTICS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#NOTES">NOTES</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#SEE-ALSO">SEE ALSO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./File::Glob.html#AUTHOR">AUTHOR</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./File::Glob.html#NAME">#</a>NAME</h1>

<p>File::Glob - Perl extension for BSD glob routine</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./File::Glob.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use File::Glob &#39;:bsd_glob&#39;;

@list = bsd_glob(&#39;*.[ch]&#39;);
$homedir = bsd_glob(&#39;~gnat&#39;, GLOB_TILDE | GLOB_ERR);

if (GLOB_ERROR) {
  # an error occurred reading $homedir
}

## override the core glob (CORE::glob() does this automatically
## by default anyway, since v5.6.0)
use File::Glob &#39;:globally&#39;;
my @sources = &lt;*.{c,h,y}&gt;;

## override the core glob, forcing case sensitivity
use File::Glob qw(:globally :case);
my @sources = &lt;*.{c,h,y}&gt;;

## override the core glob forcing case insensitivity
use File::Glob qw(:globally :nocase);
my @sources = &lt;*.{c,h,y}&gt;;

## glob on all files in home directory
use File::Glob &#39;:globally&#39;;
my @sources = &lt;~gnat/*&gt;;</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./File::Glob.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>The glob angle-bracket operator <code>&lt;&gt;</code> is a pathname generator that implements the rules for file name pattern matching used by Unix-like shells such as the Bourne shell or C shell.</p>

<p>File::Glob::bsd_glob() implements the FreeBSD glob(3) routine, which is a superset of the POSIX glob() (described in IEEE Std 1003.2 &quot;POSIX.2&quot;). bsd_glob() takes a mandatory <code>pattern</code> argument, and an optional <code>flags</code> argument, and returns a list of filenames matching the pattern, with interpretation of the pattern modified by the <code>flags</code> variable.</p>

<p>Since v5.6.0, Perl&#39;s CORE::glob() is implemented in terms of bsd_glob(). Note that they don&#39;t share the same prototype--CORE::glob() only accepts a single argument. Due to historical reasons, CORE::glob() will also split its argument on whitespace, treating it as multiple patterns, whereas bsd_glob() considers them as one pattern. But see <code>:bsd_glob</code> under <a href="./File::Glob.html#EXPORTS">&quot;EXPORTS&quot;</a>, below.</p>

<h2 id="META-CHARACTERS"><a class="permalink" href="./File::Glob.html#META-CHARACTERS">#</a><a id="META"></a>META CHARACTERS</h2>

<pre><code class="plaintext">\       Quote the next metacharacter
[]      Character class
{}      Multiple pattern
*       Match any string of characters
?       Match any single character
~       User name home directory</code></pre>

<p>The metanotation <code>a{b,c,d}e</code> is a shorthand for <code>abe ace ade</code>. Left to right order is preserved, with results of matches being sorted separately at a low level to preserve this order. As a special case <code>{</code>, <code>}</code>, and <code>{}</code> are passed undisturbed.</p>

<h2 id="EXPORTS"><a class="permalink" href="./File::Glob.html#EXPORTS">#</a>EXPORTS</h2>

<p>See also the <a href="./File::Glob.html#POSIX-FLAGS">&quot;POSIX FLAGS&quot;</a> below, which can be exported individually.</p>

<h3 id=":bsd_glob"><a class="permalink" href="./File::Glob.html#:bsd_glob">#</a><a id="bsd_glob1"></a><code>:bsd_glob</code></h3>

<p>The <code>:bsd_glob</code> export tag exports bsd_glob() and the constants listed below. It also overrides glob() in the calling package with one that behaves like bsd_glob() with regard to spaces (the space is treated as part of a file name), but supports iteration in scalar context; i.e., it preserves the core function&#39;s feature of returning the next item each time it is called.</p>

<h3 id=":glob"><a class="permalink" href="./File::Glob.html#:glob">#</a><a id="glob"></a><code>:glob</code></h3>

<p>The <code>:glob</code> tag, now discouraged, is the old version of <code>:bsd_glob</code>. It exports the same constants and functions, but its glob() override does not support iteration; it returns the last file name in scalar context. That means this will loop forever:</p>

<pre><code>    use File::Glob &#39;:glob&#39;;
    while (my $file = &lt;* copy.txt&gt;) {
	...
    }</code></pre>

<h3 id="bsd_glob"><a class="permalink" href="./File::Glob.html#bsd_glob">#</a><code>bsd_glob</code></h3>

<p>This function, which is included in the two export tags listed above, takes one or two arguments. The first is the glob pattern. The second, if given, is a set of flags ORed together. The available flags and the default set of flags are listed below under <a href="./File::Glob.html#POSIX-FLAGS">&quot;POSIX FLAGS&quot;</a>.</p>

<p>Remember that to use the named constants for flags you must import them, for example with <code>:bsd_glob</code> described above. If not imported, and <code>use strict</code> is not in effect, then the constants will be treated as bareword strings, which won&#39;t do what you what.</p>

<h3 id=":nocase-and-:case"><a class="permalink" href="./File::Glob.html#:nocase-and-:case">#</a><a id="nocase-and-:case"></a><code>:nocase</code> and <code>:case</code></h3>

<p>These two export tags globally modify the default flags that bsd_glob() and, except on VMS, Perl&#39;s built-in <code>glob</code> operator use. <code>GLOB_NOCASE</code> is turned on or off, respectively.</p>

<h3 id="csh_glob"><a class="permalink" href="./File::Glob.html#csh_glob">#</a><code>csh_glob</code></h3>

<p>The csh_glob() function can also be exported, but you should not use it directly unless you really know what you are doing. It splits the pattern into words and feeds each one to bsd_glob(). Perl&#39;s own glob() function uses this internally.</p>

<h2 id="POSIX-FLAGS"><a class="permalink" href="./File::Glob.html#POSIX-FLAGS">#</a><a id="POSIX"></a>POSIX FLAGS</h2>

<p>If no flags argument is give then <code>GLOB_CSH</code> is set, and on VMS and Windows systems, <code>GLOB_NOCASE</code> too. Otherwise the flags to use are determined solely by the flags argument. The POSIX defined flags are:</p>

<dl>

<dt id="GLOB_ERR"><a class="permalink" href="./File::Glob.html#GLOB_ERR">#</a><code>GLOB_ERR</code></dt>
<dd>

<p>Force bsd_glob() to return an error when it encounters a directory it cannot open or read. Ordinarily bsd_glob() continues to find matches.</p>

</dd>
<dt id="GLOB_LIMIT"><a class="permalink" href="./File::Glob.html#GLOB_LIMIT">#</a><code>GLOB_LIMIT</code></dt>
<dd>

<p>Make bsd_glob() return an error (GLOB_NOSPACE) when the pattern expands to a size bigger than the system constant <code>ARG_MAX</code> (usually found in limits.h). If your system does not define this constant, bsd_glob() uses <code>sysconf(_SC_ARG_MAX)</code> or <code>_POSIX_ARG_MAX</code> where available (in that order). You can inspect these values using the standard <code>POSIX</code> extension.</p>

</dd>
<dt id="GLOB_MARK"><a class="permalink" href="./File::Glob.html#GLOB_MARK">#</a><code>GLOB_MARK</code></dt>
<dd>

<p>Each pathname that is a directory that matches the pattern has a slash appended.</p>

</dd>
<dt id="GLOB_NOCASE"><a class="permalink" href="./File::Glob.html#GLOB_NOCASE">#</a><code>GLOB_NOCASE</code></dt>
<dd>

<p>By default, file names are assumed to be case sensitive; this flag makes bsd_glob() treat case differences as not significant.</p>

</dd>
<dt id="GLOB_NOCHECK"><a class="permalink" href="./File::Glob.html#GLOB_NOCHECK">#</a><code>GLOB_NOCHECK</code></dt>
<dd>

<p>If the pattern does not match any pathname, then bsd_glob() returns a list consisting of only the pattern. If <code>GLOB_QUOTE</code> is set, its effect is present in the pattern returned.</p>

</dd>
<dt id="GLOB_NOSORT"><a class="permalink" href="./File::Glob.html#GLOB_NOSORT">#</a><code>GLOB_NOSORT</code></dt>
<dd>

<p>By default, the pathnames are sorted in ascending ASCII order; this flag prevents that sorting (speeding up bsd_glob()).</p>

</dd>
</dl>

<p>The FreeBSD extensions to the POSIX standard are the following flags:</p>

<dl>

<dt id="GLOB_BRACE"><a class="permalink" href="./File::Glob.html#GLOB_BRACE">#</a><code>GLOB_BRACE</code></dt>
<dd>

<p>Pre-process the string to expand <code>{pat,pat,...}</code> strings like csh(1). The pattern &#39;{}&#39; is left unexpanded for historical reasons (and csh(1) does the same thing to ease typing of find(1) patterns).</p>

</dd>
<dt id="GLOB_NOMAGIC"><a class="permalink" href="./File::Glob.html#GLOB_NOMAGIC">#</a><code>GLOB_NOMAGIC</code></dt>
<dd>

<p>Same as <code>GLOB_NOCHECK</code> but it only returns the pattern if it does not contain any of the special characters &quot;*&quot;, &quot;?&quot; or &quot;[&quot;. <code>NOMAGIC</code> is provided to simplify implementing the historic csh(1) globbing behaviour and should probably not be used anywhere else.</p>

</dd>
<dt id="GLOB_QUOTE"><a class="permalink" href="./File::Glob.html#GLOB_QUOTE">#</a><code>GLOB_QUOTE</code></dt>
<dd>

<p>Use the backslash (&#39;\&#39;) character for quoting: every occurrence of a backslash followed by a character in the pattern is replaced by that character, avoiding any special interpretation of the character. (But see below for exceptions on DOSISH systems).</p>

</dd>
<dt id="GLOB_TILDE"><a class="permalink" href="./File::Glob.html#GLOB_TILDE">#</a><code>GLOB_TILDE</code></dt>
<dd>

<p>Expand patterns that start with &#39;~&#39; to user name home directories.</p>

</dd>
<dt id="GLOB_CSH"><a class="permalink" href="./File::Glob.html#GLOB_CSH">#</a><code>GLOB_CSH</code></dt>
<dd>

<p>For convenience, <code>GLOB_CSH</code> is a synonym for <code>GLOB_BRACE | GLOB_NOMAGIC | GLOB_QUOTE | GLOB_TILDE | GLOB_ALPHASORT</code>.</p>

</dd>
</dl>

<p>The POSIX provided <code>GLOB_APPEND</code>, <code>GLOB_DOOFFS</code>, and the FreeBSD extensions <code>GLOB_ALTDIRFUNC</code>, and <code>GLOB_MAGCHAR</code> flags have not been implemented in the Perl version because they involve more complex interaction with the underlying C structures.</p>

<p>The following flag has been added in the Perl implementation for csh compatibility:</p>

<dl>

<dt id="GLOB_ALPHASORT"><a class="permalink" href="./File::Glob.html#GLOB_ALPHASORT">#</a><code>GLOB_ALPHASORT</code></dt>
<dd>

<p>If <code>GLOB_NOSORT</code> is not in effect, sort filenames is alphabetical order (case does not matter) rather than in ASCII order.</p>

</dd>
</dl>

<h1 id="DIAGNOSTICS"><a class="permalink" href="./File::Glob.html#DIAGNOSTICS">#</a>DIAGNOSTICS</h1>

<p>bsd_glob() returns a list of matching paths, possibly zero length. If an error occurred, &amp;File::Glob::GLOB_ERROR will be non-zero and <code>$!</code> will be set. &amp;File::Glob::GLOB_ERROR is guaranteed to be zero if no error occurred, or one of the following values otherwise:</p>

<dl>

<dt id="GLOB_NOSPACE"><a class="permalink" href="./File::Glob.html#GLOB_NOSPACE">#</a><code>GLOB_NOSPACE</code></dt>
<dd>

<p>An attempt to allocate memory failed.</p>

</dd>
<dt id="GLOB_ABEND"><a class="permalink" href="./File::Glob.html#GLOB_ABEND">#</a><code>GLOB_ABEND</code></dt>
<dd>

<p>The glob was stopped because an error was encountered.</p>

</dd>
</dl>

<p>In the case where bsd_glob() has found some matching paths, but is interrupted by an error, it will return a list of filenames <b>and</b> set &amp;File::Glob::ERROR.</p>

<p>Note that bsd_glob() deviates from POSIX and FreeBSD glob(3) behaviour by not considering <code>ENOENT</code> and <code>ENOTDIR</code> as errors - bsd_glob() will continue processing despite those errors, unless the <code>GLOB_ERR</code> flag is set.</p>

<p>Be aware that all filenames returned from File::Glob are tainted.</p>

<h1 id="NOTES"><a class="permalink" href="./File::Glob.html#NOTES">#</a>NOTES</h1>

<ul>

<li><p>If you want to use multiple patterns, e.g. <code>bsd_glob(&quot;a* b*&quot;)</code>, you should probably throw them in a set as in <code>bsd_glob(&quot;{a*,b*}&quot;)</code>. This is because the argument to bsd_glob() isn&#39;t subjected to parsing by the C shell. Remember that you can use a backslash to escape things.</p>

</li>
<li><p>On DOSISH systems, backslash is a valid directory separator character. In this case, use of backslash as a quoting character (via GLOB_QUOTE) interferes with the use of backslash as a directory separator. The best (simplest, most portable) solution is to use forward slashes for directory separators, and backslashes for quoting. However, this does not match &quot;normal practice&quot; on these systems. As a concession to user expectation, therefore, backslashes (under GLOB_QUOTE) only quote the glob metacharacters &#39;[&#39;, &#39;]&#39;, &#39;{&#39;, &#39;}&#39;, &#39;-&#39;, &#39;~&#39;, and backslash itself. All other backslashes are passed through unchanged.</p>

</li>
<li><p>Win32 users should use the real slash. If you really want to use backslashes, consider using Sarathy&#39;s File::DosGlob, which comes with the standard Perl distribution.</p>

</li>
</ul>

<h1 id="SEE-ALSO"><a class="permalink" href="./File::Glob.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p><a href="perlfunc.html#glob">&quot;glob&quot; in perlfunc</a>, glob(3)</p>

<h1 id="AUTHOR"><a class="permalink" href="./File::Glob.html#AUTHOR">#</a>AUTHOR</h1>

<p>The Perl interface was written by Nathan Torkington &lt;gnat@frii.com&gt;, and is released under the artistic license. Further modifications were made by Greg Bacon &lt;gbacon@cs.uah.edu&gt;, Gurusamy Sarathy &lt;gsar@activestate.com&gt;, and Thomas Wegner &lt;wegner_thomas@yahoo.com&gt;. The C glob code has the following copyright:</p>

<p>Copyright (c) 1989, 1993 The Regents of the University of California. All rights reserved.</p>

<p>This code is derived from software contributed to Berkeley by Guido van Rossum.</p>

<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>

<ol>

<li><p>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</p>

</li>
<li><p>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</p>

</li>
<li><p>Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.</p>

</li>
</ol>

<p>THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
